﻿using UnityEngine;
using System.Collections;

public class TopUI : MonoBehaviour {

    public bool m_bInHover;
    bool m_bActivateHover;

    void Start()
    {
        m_bActivateHover = true;
        m_bInHover = false;
    }

    void OnHover(bool isOver)
    {
        if (isOver)
            m_bInHover = true;
        else
            m_bInHover = false;
    }

    //public void UIPopDown(bool isDown)
    //{
    //    if (isDown)
    //    {
    //        GameObject.Find("MoneyUI").GetComponent<TweenPosition>().Play(true);
    //        GetComponent<BoxCollider>().enabled = false;
    //        m_bActivateHover = false;
    //    }
    //    else
    //    {
    //        GameObject.Find("MoneyUI").GetComponent<TweenPosition>().Play(false);
    //        GetComponent<BoxCollider>().enabled = true;
    //        m_bActivateHover = true;
    //    }
    //}

    void LateUpdate()
    {
        if (m_bActivateHover)
        {
            if (m_bInHover)
            {
                GameObject.Find("MoneyUI").GetComponent<TweenPosition>().Play(true);
                GameObject.Find("TableUI").GetComponent<TweenPosition>().Play(true);
            }
            else
            {
                GameObject.Find("MoneyUI").GetComponent<TweenPosition>().Play(false);
                GameObject.Find("TableUI").GetComponent<TweenPosition>().Play(false);
            }
        }
    }
}
